<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

if(!function_exists('uf_dropdown')){
	function uf_dropdown($nome, $selecionado = '', $extra = ''){
		$ufs = array(
			'' => 'Selecione...',
			'AC' => 'Acre',
			'AL' => 'Alagoas',
		 	'AM' => 'Amazonas',
		 	'AP' => 'Amapá',
			'BA' => 'Bahia',
			'CE' => 'Ceará',
			'DF' => 'Distrito Federal',
			'ES' => 'Espírito Santo',
			'GO' => 'Goiás',
			'MA' => 'Maranhão',
			'MT' => 'Mato Grosso',
			'MS' => 'Mato Grosso do Sul',
			'MG' => 'Minas Gerais',
			'PA' => 'Pará',
			'PB' => 'Paraíba',
			'PR' => 'Paraná',
			'PE' => 'Pernambuco',
			'PI' => 'Piauí',
			'RJ' => 'Rio de Janeiro',
			'RN' => 'Rio Grande do Norte',
			'RO' => 'Rondônia',
			'RS' => 'Rio Grande do Sul',
			'RR' => 'Roraima',
			'SC' => 'Santa Catarina',
			'SE' => 'Sergipe',
			'SP' => 'São Paulo',
			'TO' => 'Tocantins'
		);
		
		return form_dropdown($nome, $ufs, $selecionado, $extra);
	}
}

if(!function_exists('getRegiao')){
	
	function getRegiao($uf) {	
		$regioes = array(
			'AC' => 'Norte',
			'AL' => 'Nordeste',
		 	'AM' => 'Norte',
		 	'AP' => 'Norte',
			'BA' => 'Nordeste',
			'CE' => 'Nordeste',
			'DF' => 'CentroOeste',
			'ES' => 'Sudeste',
			'GO' => 'CentroOeste',
			'MA' => 'Nordeste',
			'MT' => 'CentroOeste',
			'MS' => 'CentroOeste',
			'MG' => 'Sudeste',
			'PA' => 'Norte',
			'PB' => 'Nordeste',
			'PR' => 'Sul',
			'PE' => 'Nordeste',
			'PI' => 'Nordeste',
			'RJ' => 'Sudeste',
			'RN' => 'Nordeste',
			'RO' => 'Norte',
			'RS' => 'Sul',
			'RR' => 'Norte',
			'SC' => 'Sul',
			'SE' => 'Nordeste',
			'SP' => 'Sudeste',
			'TO' => 'Norte'
		);
		$regiao = $regioes[$uf];
		return (!empty($regiao)) ? $regiao : 'Região não definida';
	}
	
	function pais_dropdown($nome, $selecionado = '', $extra = '') {
		$paises = array(
			'' => 'Selecione...',
			'BR' => 'Brazil - Brasil',
			'AL' => 'Albania',
			'DZ' => 'Algeria',
			'AD' => 'Andorra',
			'AO' => 'Angola',
			'AI' => 'Anguilla',
			'AG' => 'Antigua and Barbuda',
			'AR' => 'Argentina',
			'AM' => 'Armenia',
			'AW' => 'Aruba',
			'AU' => 'Australia',
			'AT' => 'Austria - Österreich',
			'AZ' => 'Azerbaijan Republic',
			'BS' => 'Bahamas',
			'BH' => 'Bahrain',
			'BB' => 'Barbados',
			'BE' => 'Belgium',
			'BZ' => 'Belize - Belice',
			'BJ' => 'Benin - Bénin',
			'BM' => 'Bermuda',
			'BT' => 'Bhutan',
			'BO' => 'Bolivia',
			'BA' => 'Bosnia and Herzegovina',
			'BW' => 'Botswana',			
			'VG' => 'British Virgin Islands',
			'BN' => 'Brunei',
			'BG' => 'Bulgaria',
			'BF' => 'Burkina Faso',
			'BI' => 'Burundi',
			'KH' => 'Cambodia',
			'CA' => 'Canada',
			'CV' => 'Cape Verde',
			'KY' => 'Cayman Islands',
			'TD' => 'Chad - Tchad',
			'CL' => 'Chile',
			'C2' => 'China Worldwide',
			'CO' => 'Colombia',
			'KM' => 'Comoros - Comores',
			'CK' => 'Cook Islands',
			'CR' => 'Costa Rica',
			'HR' => 'Croatia',
			'CY' => 'Cyprus',
			'CZ' => 'Czech Republic',
			'CD' => 'Democratic Republic of the Congo',
			'DK' => 'Denmark - Danmark',
			'DJ' => 'Djibouti',
			'DM' => 'Dominica',
			'DO' => 'Dominican Republic',
			'EC' => 'Ecuador',
			'SV' => 'El Salvador',
			'ER' => 'Eritrea',
			'EE' => 'Estonia',
			'ET' => 'Ethiopia',
			'FK' => 'Falkland Islands',
			'FO' => 'Faroe Islands',
			'FM' => 'Federated States of Micronesia',
			'FJ' => 'Fiji',
			'FI' => 'Finland',
			'FR' => 'France',
			'GF' => 'French Guiana',
			'PF' => 'French Polynesia',
			'GA' => 'Gabon Republic',
			'GM' => 'Gambia',
			'DE' => 'Germany - Deutschland',
			'GI' => 'Gibraltar',
			'GR' => 'Greece',
			'GL' => 'Greenland',
			'GD' => 'Grenada',
			'GP' => 'Guadeloupe',
			'GT' => 'Guatemala',
			'GN' => 'Guinea - Guinée',
			'GW' => 'Guinea Bissau',
			'GY' => 'Guyana',
			'HN' => 'Honduras',
			'HK' => 'Hong Kong',
			'HU' => 'Hungary',
			'IS' => 'Iceland',
			'IN' => 'India',
			'ID' => 'Indonesia',
			'IE' => 'Ireland',
			'IL' => 'Israel',
			'IT' => 'Italy - Italia',
			'JM' => 'Jamaica',
			'JP' => 'Japan - ??',
			'JO' => 'Jordan',
			'KZ' => 'Kazakhstan',
			'KE' => 'Kenya',
			'KI' => 'Kiribati',
			'KW' => 'Kuwait',
			'KG' => 'Kyrgyzstan',
			'LA' => 'Laos',
			'LV' => 'Latvia',
			'LS' => 'Lesotho',
			'LI' => 'Liechtenstein',
			'LT' => 'Lithuania',
			'LU' => 'Luxembourg',
			'MG' => 'Madagascar',
			'MW' => 'Malawi',
			'MY' => 'Malaysia',
			'MV' => 'Maldives',
			'ML' => 'Mali',
			'MT' => 'Malta',
			'MH' => 'Marshall Islands',
			'MQ' => 'Martinique',
			'MR' => 'Mauritania',
			'MU' => 'Mauritius',
			'YT' => 'Mayotte',
			'MX' => 'Mexico - México',
			'MN' => 'Mongolia',
			'MS' => 'Montserrat',
			'MA' => 'Morocco',
			'MZ' => 'Mozambique',
			'NA' => 'Namibia',
			'NR' => 'Nauru',
			'NP' => 'Nepal',
			'NL' => 'Netherlands - Nederland',
			'AN' => 'Netherlands Antilles',
			'NC' => 'New Caledonia',
			'NZ' => 'New Zealand',
			'NI' => 'Nicaragua',
			'NE' => 'Niger',
			'NU' => 'Niue',
			'NF' => 'Norfolk Island',
			'NO' => 'Norway - Norge',
			'OM' => 'Oman',
			'PW' => 'Palau',
			'PA' => 'Panama - Panamá',
			'PG' => 'Papua New Guinea',
			'PE' => 'Peru - Perú',
			'PH' => 'Philippines',
			'PN' => 'Pitcairn Islands',
			'PL' => 'Poland - Polska',
			'PT' => 'Portugal',
			'QA' => 'Qatar',
			'CG' => 'Republic of the Congo',
			'RE' => 'Reunion',
			'RO' => 'Romania',
			'RU' => 'Russia - ??????',
			'RW' => 'Rwanda',
			'VC' => 'Saint Vincent and the Grenadines',
			'WS' => 'Samoa',
			'SM' => 'San Marino',
			'ST' => 'São Tomé and Príncipe',
			'SA' => 'Saudi Arabia',
			'SN' => 'Senegal - Sénégal',
			'SC' => 'Seychelles',
			'SL' => 'Sierra Leone',
			'SG' => 'Singapore',
			'SK' => 'Slovakia',
			'SI' => 'Slovenia',
			'SB' => 'Solomon Islands',
			'SO' => 'Somalia',
			'ZA' => 'South Africa',
			'KR' => 'South Korea',
			'ES' => 'Spain - España',
			'LK' => 'Sri Lanka',
			'SH' => 'St. Helena',
			'KN' => 'St. Kitts and Nevis',
			'LC' => 'St. Lucia',
			'PM' => 'St. Pierre and Miquelon',
			'SR' => 'Suriname',
			'SJ' => 'Svalbard and Jan Mayen Islands',
			'SZ' => 'Swaziland',
			'SE' => 'Sweden - Sverige',
			'CH' => 'Switzerland - Schweiz',
			'TW' => 'Taiwan - ??',
			'TJ' => 'Tajikistan',
			'TZ' => 'Tanzania',
			'TH' => 'Thailand - ?????????',
			'TG' => 'Togo',
			'TO' => 'Tonga',
			'TT' => 'Trinidad and Tobago',
			'TN' => 'Tunisia',
			'TR' => 'Turkey - Türkiye',
			'TM' => 'Turkmenistan',
			'TC' => 'Turks and Caicos Islands',
			'TV' => 'Tuvalu',
			'UG' => 'Uganda',
			'UA' => 'Ukraine',
			'AE' => 'United Arab Emirates',
			'GB' => 'United Kingdom',
			'US' => 'United States',
			'UY' => 'Uruguay',
			'VU' => 'Vanuatu',
			'VA' => 'Vatican City State',
			'VE' => 'Venezuela',
			'VN' => 'Vietnam',
			'WF' => 'Wallis and Futuna Islands',
			'YE' => 'Yemen',
			'ZM' => 'Zambia'
		);
		
		return form_dropdown($nome, $paises, $selecionado, $extra);
	}
	
}